package com.WJY.controller;

import com.WJY.pojo.Dept;
import com.WJY.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;

    public List<Dept> queryAllDept() {
        return deptService.queryAllDept();
    }

    public Dept queryDeptById(int id) {
        return deptService.queryDeptById(id);
    }

    public String delDeptById(int id) {
        return deptService.delDeptById(id) ? "删除成功" : "删除失败";
    }

    public String addDept(Dept dept) {
        return deptService.addDept(dept) ? "新增成功" : "新增失败";
    }

    public String updateDept(Dept dept) {
        return deptService.updateDept(dept) ? "更新成功" : "更新失败";
    }
}
